/*==============================================================================
             Copyright (c) 2009 - All rights reserved
================================================================================
File description:

    Preview function definition

================================================================================
      Date            Name                    Description of Change
15-Sep-2009  Xiaofeng.Gu                    Written
$HISTORY$
==============================================================================*/
#pragma once
#include "IGraphics.h"

class CGViewer;
class CGraphicsPlatform;
class CGraphPlotter;

class CPreviewGraphics : public IRender
{
public:
	CPreviewGraphics(CGViewer* pViewer);
	virtual~ CPreviewGraphics();

	virtual void			InitializeByPixel(int pixelLenth) = 0;
	int						GetPixelLength() { return m_iPixelLenth; }

protected:
	CVec					m_oBasePt;
	int						m_iPixelLenth;
	double					m_dPreviewDistance;
	CGViewer*				m_pViewer;
	CGraphicsPlatform*		m_pPlatform;
	CGraphPlotter*			m_pPlotter;
};


class CLineArrowGraphics : public CPreviewGraphics
{
public:
	CLineArrowGraphics(CGViewer* pViewer);
	virtual~ CLineArrowGraphics();

	virtual void			InitializeByPixel(int pixelLenth);
	virtual void			Render();

	void					SetArrowDirection(const CVec& dir) { m_oDirection = dir; }
	void					SetArrowLength(double dLength) { m_dLength = dLength; }
	void					SetBasePt(const CVec& basePt) { m_oBasePt = basePt; }

private:
	CVec					m_oDirection;
	double					m_dLength;
};



class CCoordinateSystemGraphics : public CPreviewGraphics
{
public:
	CCoordinateSystemGraphics(CGViewer* pViewer);
	virtual~ CCoordinateSystemGraphics();

	virtual void			InitializeByPixel(int pixelLenth);
	virtual void			Render();

	void					SetFixedPosition(int x, int y) { m_x = x; m_y = y; }
	bool					IsInit() { return m_bInit; }

private:
	int						m_x;
	int						m_y;
	double					m_dLength;
	bool					m_bInit;
};